﻿using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;

namespace GeekShop
{
    public partial class PictureForm : Form
    {
        #region Fields
        private Picture picture;
        #endregion

        #region Properties
        internal Picture Picture
        {
            get { return picture; }
            set { picture = value; }
        }
        public PictureBox PictureBox
        {
            get { return this.pictureBox; }
        }
        #endregion

        #region Constructors
        public PictureForm(Picture picture, Form mdiParent)
        {
            InitializeComponent();

            this.picture = picture;
            this.MdiParent = mdiParent;
            this.pictureBox.Size = this.picture.Size;
            this.pictureBox.Image = this.picture.Bitmap;
            if (this.picture.Path != null && this.picture.Path != "")
            {
                this.Text = this.picture.Path;
            }
            else 
            {
                this.Text = "New Picture";
            }
            this.Show();
        }
        #endregion

        #region Overwritten Methods
        public override void Refresh()
        {
            this.pictureBox.Image = this.picture.Bitmap;
            base.Refresh();
        }
        #endregion
    }
}
